package week03.holiday;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zhangxiaokun on 2018/2/8.
 */
public class VacationPlanner {
    private List<DayPlanner> dayPlannerList = new ArrayList<>();

    //获取指定某天的 计划
    public DayPlanner getOneDayPlanner(int indexOfDay){
        if (checkIndexOfDay(indexOfDay)) {
            return dayPlannerList.get(indexOfDay);
        } else {
            return null;
        }
    }
    //删除指定某天 的计划
    public void delOneDayPlanner(int indexOfDay) {
        indexOfDay --;
        if (checkIndexOfDay(indexOfDay)) {
            dayPlannerList.remove(indexOfDay);
        }
    }

    //检查 第几天
    private boolean checkIndexOfDay(int indexOfDay) {
        return  indexOfDay >= 0 && indexOfDay <= dayPlannerList.size();
    }


    public List<DayPlanner> getDayPlannerList() {
        return dayPlannerList;
    }

    public void setDayPlannerList(List<DayPlanner> dayPlannerList) {
        this.dayPlannerList = dayPlannerList;
    }

    public void showPlaner() {
        //展示假期计划  每一天
        for (int i=0; i<dayPlannerList.size(); i++) {
            System.out.println("=====假期第"+ (i+1) +"天==============");
            dayPlannerList.get(i).showDayPlanner();
        }
    }

}
